#!/bin/sh
set -eu

m=30

if find dist/pre-push -mmin -$m | grep .; then
  echo "✅  Pre-pushing check looks good."
  exit 0
else
  # Allows to read user input below, assigns stdin to keyboard
  exec < /dev/tty
  echo "⚠️ \`make pre-push -B\` should be run before pushing changes. It has not been run for over ${m}m."
  echo
  echo "Do you still want to continue? (n/Y)" && read ans
  if [[ ${ans:-n} = Y ]]; then
    exit 0
  else
    exit 1
  fi
fi

